<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>



    //filter()“过滤”功能，数组中的每一项运行给定函数，返回满足过滤条件组成的数组
    var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
    var arr2 = arr.filter((x, index) => {
      // return index % 2 === 0 && x >= 7;//[7, 9]
      // return index % 2 === 0 || x >= 7;//[1, 3, 5, 7, 8, 9, 10]
      return index > 5;//把大于5的筛选出放进新的arr2中 //return(trun)
    })
    console.log(arr2)
    console.log(2%2 === 0)


    // every()//判断数组中每一项都是否满足条件，只有所有项都满足条件，才会返回true
    // var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
    // var arr2 = arr.every((x) => {
    //   return x < 13;
    // });
    // console.log(arr2)//true

    //some() //判断数组中是否存在满足条件的项，只要有一项满足条件，就会返回true。
    // var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
    

  </script>
</body>

</html>